﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WS.EKA.Business.Model;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace WS.EKA.UI.Business
{
    /// <summary>
    /// 今日事件工单按故障类型（大类）
    /// </summary>
    internal class TodayByFaultIncident : ReportBase<List<TodayIncidentByFaultForUI>>
    {
        public override WebSocketClientType Key
        {
            get
            {
                return WebSocketClientType.Incident_TodayIncidentByFault;
            }
        }

        public override string GetJsonString(object parameter)
        {
            var obj = parameter as ReportParameter<List<TodayIncidentByFaultForUI>>;
            JArray array = new JArray();
            foreach (var item in obj.Data)
            {
                JArray j = new JArray();
                j.Add(item.Category);
                j.Add(item.Count);
                array.Add(j);
            }
            string str = JsonConvert.SerializeObject(array);
            return "[" + str + "]";
        }
    }
}
